local Lua__yuyu = fk.CreateSkill {

  name = "Lua__yuyu",

  tags = { Skill.Compulsory },

}

Fk:loadTranslationTable{
    ["Lua__yuyu"] = "玉玉",
    [":Lua__yuyu"] = "锁定技，当你的体力值变化时，你摸两张牌，手牌上限+1；回合开始时，若你的体力值大于2，你失去一点体力。",
    ["@yuyu_limit"] = "玉玉上限+",
}

Lua__yuyu:addEffect(fk.HpChanged, {
    anim_type = "support",
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(Lua__yuyu.name) then return false end
        return target == player
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        player:drawCards(2, Lua__yuyu.name)
        room:addPlayerMark(player, "@yuyu_limit", 1)
    end,
})
Lua__yuyu:addEffect(fk.TurnStart, {
    anim_type = "support",
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(Lua__yuyu.name) then return false end
        return target == player  and player.hp > 2
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:loseHp(player, 1, Lua__yuyu.name)
    end,
})

Lua__yuyu:addEffect("maxcards", {
  name = "#Lua__yuyuMaxCards",
    correct_func = function(self, player)
      return player:getMark("@yuyu_limit")
    end,
})

return Lua__yuyu